﻿using System.Web.Script.Services;
using System.Web.Services;
using SinBiota.Model.Business.DataAccess;
using StructureMap;

namespace Sinbiota.Web.Services.Ajax
{
    /// <summary>
    /// Summary description for AutoCompleteService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [ScriptService]
    public class AutoCompleteService : WebService
    {

        private readonly IAutoCompleteServices _autoCompleteServices;

        public AutoCompleteService()
        {
            _autoCompleteServices = ObjectFactory.GetInstance<IAutoCompleteServices>();
        }

        [WebMethod]
        [ScriptMethod(ResponseFormat=ResponseFormat.Json)]
        public string[] GetTaxonAutoCompleteList(string prefixText, int count)
        {
            return _autoCompleteServices.GetTaxonAutoCompleteList(prefixText, count);
        }
    }
}
